$(function () {
    $("#add").click(function () {
        $.ajax({
            url: "http://localhost:8081/user/add",
            contentType: "application/json", //必须这样写
            dataType: "json",
            type: "POST",
            data: JSON.stringify({ "name": $("#name").val(), "age": 45 }),
            success: function () {
                alert("OK");
            }
        })
    })

});

